package com.mjk.common.core.jdbc.service.plus.constns;

import com.mjk.common.base.model.BaseEntity;
import com.mjk.common.core.jdbc.ibatis.typehandler.BaseHandler;
import lombok.Data;
import org.apache.ibatis.type.JdbcType;

/**
 * 关系映射实体类
 * 
 * @author Administrator
 *
 */
@Data
public class BeeTypeEntity extends BaseEntity {
	public BeeTypeEntity() {
	}

    public BeeTypeEntity(JdbcType type, String jdbcType, String javaType, String lenght, int leavel, BaseHandler resovleClass) {
        this.jdbcType = type;
        this.jdbcTypeName = jdbcType;
		this.leavel=leavel;
		this.javaType = javaType;
		this.lenght = lenght;
		this.resovleClass = resovleClass;
	}
	public BeeTypeEntity(JdbcType type, String jdbcType, String javaType, String lenght, BaseHandler resovleClass) {
        this.jdbcType = type;
        this.jdbcTypeName = jdbcType;
		this.javaType = javaType;
		this.lenght = lenght;
		this.resovleClass = resovleClass;
	}

    private JdbcType jdbcType;
    private String jdbcTypeName;
	private String javaType;
	private String lenght;
	private int leavel;//权重 优先使用权重低的
	private transient BaseHandler resovleClass;
	
	@Override
    public boolean equals(Object obj){
        if(obj == null){
            return false;
        }
        if(this == obj){
            return true;
        }
        if(!(obj instanceof BeeTypeEntity tmp)){
            return false;
        }
		//向下转型，比较属性值
        return this.jdbcType.equals(tmp.jdbcType) && this.javaType.equals(tmp.javaType);
    }
	@Override
	public int hashCode() {
        return this.jdbcType.hashCode();
	}
}
